home *** CD-ROM | disk | FTP | other *** search
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Full source code of freeware utility called PTReplay. *
- * *
- * It utility lets easy way to play modules in protracker format with *
- * xpk compression support. *
- * *
- * Usage: PTReplay MODULE_NAME *
- * or PTReplay STOP *
- * or PTReplay ? *
- * *
- * For example: PTReplay start.mod *
- * *
- * Requirements: xpkmaster.library version 2 or above, *
- * ptreplay.library version 4 or above. *
- * *
- * Note: - For stop play use keyword STOP or send any break signal to *
- * process which PTReplay was launched from. *
- * *
- * Author: Sergeev Oleg, Saint-Petersburg, Russia, 1997. *
- * *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
- #define __USE_SYSBASE
- #include <proto/exec.h>
- #include <exec/types.h>
- #include <exec/memory.h>
-
- #include <clib/dos_protos.h>
- #include <pragmas/dos_pragmas.h>
- #include <dos/rdargs.h>
- #define MIN_DOS_VERSION 36L
-
- #include <pragma/xpkmaster_lib.h>
- #include <xpk/xpk.h>
- #define MIN_XPK_VERSION 2L
-
- #include <clib/ptreplay_protos.h>
- #include <pragmas/ptreplay_pragmas.h>
- #include <libraries/ptreplay.h>
- #define MIN_PTREPLAY_VERSION 4L
-
- #define TEMPLATE "MODULE,STOP/S"
- #define ALL_BREAKF (SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D | SIGBREAKF_CTRL_E | SIGBREAKF_CTRL_F)
-
- struct XpkData
- {
- ULONG outputsize;
- ULONG buffersize;
- STRPTR buffer;
- };
-
- enum { ARG_MODULE, ARG_STOP, ARG_TERMINATOR };
-
- ///¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
- ///
- LONG main (void)
- {
- struct ExecBase *SysBase = (*((struct ExecBase **)4));
- struct Library *DOSBase, *XpkBase, *PTReplayBase;
- struct RDArgs *rdargs;
- struct XpkData xpkd;
- struct Module *module;
- struct Task *task;
- UBYTE taskname[] = "PTReplay 1.1 by Sergeev O.V.";
- STRPTR args[ARG_TERMINATOR];
-
- if (DOSBase = OpenLibrary (DOSNAME, MIN_DOS_VERSION))
- {
- if (XpkBase = OpenLibrary (XPKNAME, MIN_XPK_VERSION))
- {
- if (PTReplayBase = OpenLibrary (PTREPLAYNAME, MIN_PTREPLAY_VERSION))
- {
- args[ARG_MODULE] = NULL;
- args[ARG_STOP] = FALSE;
- if (rdargs = ReadArgs (TEMPLATE, (LONG *)args, NULL))
- {
- if ((args[ARG_STOP]) && (task = FindTask (taskname)))
- Signal (task, ALL_BREAKF);
- else if (! XpkUnpackTags (XPK_InName, args[ARG_MODULE],
- XPK_OutMemType, MEMF_CHIP,
- XPK_GetOutBuf, &xpkd.buffer,
- XPK_GetOutLen, &xpkd.outputsize,
- XPK_GetOutBufLen, &xpkd.buffersize,
- XPK_PassThru, TRUE,
- TAG_DONE))
- {
- if (module = PTSetupMod (xpkd.buffer))
- {
- if (PTPlay (module))
- {
- (FindTask(NULL))->tc_Node.ln_Name = taskname;
- Wait (ALL_BREAKF);
- PTFade (module, 2);
- PTStop (module);
- }
- PTFreeMod (module);
- }
- FreeMem (xpkd.buffer, xpkd.buffersize);
- }
- FreeArgs (rdargs);
- }
- CloseLibrary (PTReplayBase);
- }
- CloseLibrary (XpkBase);
- }
- CloseLibrary (DOSBase);
- }
- return (0L);
- }
-